<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('单据查询列表')" />
	<th:block th:include="include :: list-css" />
</head>

<body class="no-skin">
    <!-- 表格操作区 -->
    <script type="text/html" id="barDh" th:if="${moduleTable} eq 'TCG_OFFLINEPURCHASEORDER'">
        <a class="layui-btn layui-btn-danger layui-btn-xs isshow" onclick="wledit('{{d.guid}}','{{d.bid}}','{{d.state}}','{{d.isPay}}','{{d.price2}}','{{d.sum}}','{{d.nid}}')" th:if="${extraButton.upbtn}">修改到货数量</a>
        <a class="layui-btn layui-btn-disabled layui-btn-xs isshow"  th:if="!${extraButton.upbtn}">订单修改</a>
    </script>
<script th:inline="javascript">
    /*<![CDATA[*/
    var gridColumns = [[${gridColumns}]],
        business = [[${purchase}]],
        buttonState = [[${buttonState}]],
        businessName = gridColumns.moduleAlias,
        passwordAuthentication = [[${passwordAuthentication}]],
        extraButton = [[${extraButton}]],
        moduleTable = [[${moduleTable}]];
    /*]]>*/
    var prefix = "/purchase/"+business;
	var tableUrl = prefix + "/list",
	openRowUrl = "/purchase/"+(business.split('/')[1]?business.split('/')[0]:business)+"/edit?nid=";
	exportUrl = prefix + "/export";
</script>

<th:block th:include="listinclude :: container" />
<th:block th:include="include :: footer" />
<th:block th:include="include :: tableBtn" />
<th:block th:include="listinclude :: list-templeat" />
<th:block th:include="include :: searchJS" />
<th:block th:include="include :: listJS" />
<script type="text/javascript">
    var $,layer,form,table,laydate,element;//定义layui模块
    layui.use(['laydate', 'table','form','layer','jquery','util','element'], function () {
     	$ = layui.$,layer = layui.layer,form = layui.form,table = layui.table,laydate = layui.laydate,util = layui.util,element=layui.element;
        window.wledit=function(guid,bid,state,isPay,price2,sum,nid){
		    layer.open({
                type: 1,
		        title:'物流轨迹',
                area: ['500px', '300px'], //宽高
                content:`<div class="layui-row" style="padding:20px 0;">
		    	        <div class="layui-inline layui-col-sm12">
                            <label class="layui-form-label">单据编号：</label>
                            <div class="layui-input-block">
                                <input id="bid" type="text" name="bid" autocomplete="off" value="${bid}" disabled class="layui-input">
                            </div>
                        </div>
                        <div class="layui-inline layui-col-sm12">
                            <label class="layui-form-label">子件实际单价：</label>
                            <div class="layui-input-block">
                                <input id="price2" type="text" name="price2" autocomplete="off" value="${price2}" class="layui-input">
                            </div>
                        </div>
		    			<div class="layui-inline layui-col-sm12">
                            <label class="layui-form-label">采购总数：</label>
                            <div class="layui-input-block">
                                <input id="sum" type="text" name="sum" autocomplete="off" value="${sum}" class="layui-input">
                            </div>
                        </div>

		    		</div>`,
		    		btn: ['确定', '取消'],
    	    		yes: function(index, layero){
		    			showloadings(true);
		    			var data={guid,bid,'sum':$('#sum').val(),'price2':$('#price2').val(),nid}
    	    		    $.post("/purchase/offlinepurchaseorder/saveLogistics",{'infoItems':JSON.stringify(data)},function(res){
                            layer.msg(res.msg)
                            if(res.code==0){
                                setTimeout(function(){
		    						table.reload('dhtable');
		    						layer.close(index); //如果设定了yes回调，需进行手工关闭
                                }, 800);
                            }
		    				showloadings(false);
                        })
    	    		}
    	    });
	    }
    })
</script>


</body>
</html>